-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Allow use of multiple extension galleries #2620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d025f0e
to
e7a8d89
Compare
@oxy You should be able to fix the |
Just to clarify here - are only the first page of OpenVSX's extensions available with this change? Or are all of them available? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @oxy 🎉 I'm so excited for this. I left a few minor non-blocking suggestions and questions. Might be good to get an eye from someone else on the team just as extra assurance.
private api(path = ''): string { | ||
return `${this.extensionsGalleryUrl}${path}`; | ||
private api(path = ''): string[] { | ||
if (!!this.extensionsGalleryUrl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the double !
to convert it to a boolean? Does it have a performance advantage over the Boolean function? Only asking/suggesting if it might improve readability - obviously your call :D
if (!!this.extensionsGalleryUrl) { | |
if (Boolean(this.extensionsGalleryUrl)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I should just use this.isEnabled()
instead - does the same check in practice but is probably ideal since the code already exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good thinking!
} | ||
|
||
async reportStatistic(publisher: string, name: string, version: string, type: StatisticType): Promise<void> { | ||
// TODO: investigate further - currently we just send stats everywhere |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know folks have GitLens and tools to know who left a TODO comment but at least this puts your name right there so we don't forget.
// TODO: investigate further - currently we just send stats everywhere | |
// TODO(oxy): investigate further - currently we just send stats everywhere |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 will fix!
} | ||
|
||
async reportStatistic(publisher: string, name: string, version: string, type: StatisticType): Promise<void> { | ||
// TODO: investigate further - currently we just send stats everywhere | ||
// this is only used in one place - uninstall tracking - but |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfinished comment? Was there more to this sentence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, there was!
was supposed to say but unsure if MS will start using this elsewhere
This PR should implement support for using multiple extension galleries by default.
There's quite a few things that may be slightly hacky about it, since VSCode's extension gallery design is confusingly broken:
galleryUrl
is used for/extensionquery
and uninstall statisticsitemUrl
is supposedly used for linking to item pages but is not essential for functionality (and our gallery doesn't support it) so I just left it outcontrolUrl
appears to be used for reporting malicious extensions, neither OpenVSX nor our gallery supports thisrecommendationsUrl
provides recommendations but neither OpenVSX nor our gallery supports thisAwkward thing here is that
galleryUrl
on first glance appears to be the base URL for the whole API, and internally/extensionquery
is appended to it, but then they go ahead and include separate URLs for other extension gallery functionality - which is quite confusing.So, I just changed the type of
galleryUrl
fromstring
tostring[]
and patched the methods that read from it.It might also be possible to change the type of
extensionGallery
to a list of objects instead of an object with a list ofgalleryUrl
- but given that the other variables aren't really used by either of the two galleries we plan to primarily support (ours and OpenVSX's), so I tried to minimize engineering time there.I've tested the result by installing extensions from both OpenVSX and our repo - and it works fine!
Also, right now, I don't actually resort results to merge the two lists; it's just all of OpenVSX's first page, with all of Coder's (with duplicates filtered) after that.